﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class JobPositionManagementBL
	{

		#region ***** Init Methods ***** 
		JobPositionManagementDA objJobPositionManagementDA;
		public JobPositionManagementBL()
		{
			objJobPositionManagementDA = new JobPositionManagementDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get JobPositionManagement by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>JobPositionManagement</returns>
        public JobPositionManagement GetByID(int id, int PersonalProfileID)
		{
            return objJobPositionManagementDA.GetByID(id, PersonalProfileID);
		}

		/// <summary>
		/// Get all of JobPositionManagement
		/// </summary>
		/// <returns>List<<JobPositionManagement>></returns>
		public List<JobPositionManagement> GetList()
		{
			string cacheName = "lstJobPositionManagement";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objJobPositionManagementDA.GetList(), "JobPositionManagement");
			}
			return (List<JobPositionManagement>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of JobPositionManagement
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetOld()
		{
			string cacheName = "dsJobPositionManagement";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objJobPositionManagementDA.GetDataSetOld(), "JobPositionManagement");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}

        public DataSet GetDataSet(int PersonalProfileID)
        {
            string cacheName = "dsJobPositionManagement";
            ServerCache.Remove("JobPositionManagement", true);
            if (ServerCache.Get(cacheName) == null)
            {
                ServerCache.Insert(cacheName, objJobPositionManagementDA.GetDataSet(PersonalProfileID), "JobPositionManagement");
            }
            return (DataSet)ServerCache.Get(cacheName);
        }

		/// <summary>
		/// Get all of JobPositionManagement paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<JobPositionManagement>></returns>
		public List<JobPositionManagement> GetListPaged(int recperpage, int pageindex)
		{
			return objJobPositionManagementDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of JobPositionManagement paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objJobPositionManagementDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new JobPositionManagement within JobPositionManagement database table
		/// </summary>
		/// <param name="obj_jobpositionmanagement">JobPositionManagement</param>
		/// <returns>key of table</returns>
		public int Add(JobPositionManagement obj_jobpositionmanagement)
		{
			ServerCache.Remove("JobPositionManagement", true);
			return objJobPositionManagementDA.Add(obj_jobpositionmanagement);
		}

		/// <summary>
		/// updates the specified JobPositionManagement
		/// </summary>
		/// <param name="obj_jobpositionmanagement">JobPositionManagement</param>
		/// <returns></returns>
		public void Update(JobPositionManagement obj_jobpositionmanagement)
		{
			ServerCache.Remove("JobPositionManagement", true);
			objJobPositionManagementDA.Update(obj_jobpositionmanagement);
		}

		/// <summary>
		/// Delete the specified JobPositionManagement
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("JobPositionManagement", true);
			objJobPositionManagementDA.Delete(id);
		}
		#endregion
	}
}
